<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>首页-{$tpshop_config['shop_info_store_title']}</title>
    <link href="__PUBLIC__/static/css/tp-base.css" rel="stylesheet" />
    <link href="__PUBLIC__/static/css/tp-m-package.css" rel="stylesheet" />
    <script src="__PUBLIC__/static/js/zepto-1.1.6-min.js" type="text/javascript"></script>
    <script src="__STATIC__/js/mobile-util.js" type="text/javascript" charset="utf-8"></script>
    <script src="__PUBLIC__/static/js/swipeSlide.min.js" type="text/javascript"></script>
    <script src="/template/mobile/rainbow/static/js/layer.js"  type="text/javascript" ></script>
    <script src="__PUBLIC__/js/global.js"></script>
    <script src="__PUBLIC__/static/js/tp-drag-join-module.js"></script>
	
</head>
<body>
{$html}
<div style="display:none" id="template_info">{$info}</div>
</body>
<script type="text/javascript" >
    var info=JSON.parse($('#template_info').html());
    if(info.is_search==1){
        var logo='{$wap_logo}';
        $('.tpd-logo').find('img').attr('src',logo);
    }
	var end_time='';
	$(document).ready(function(){
        if($('.hms')){
            var url="{:U('Mobile/Index/get_flash')}";
            $.post(url,{'num':3},function(res){
                $('#flash_list').html(res.html);
                $('#flash_time').html(res.start_time+'点专场');
                end_time=res.end_time;
                setInterval(GetRTime2,1000);
            },'json'); 
        }

        var user_id='{$user_id}';
        if((parseInt(user_id))>0){
            $('#login_url').attr('href','/mobile/user/index');
            $('#login_ico').html('<img class="after_login" src="__STATIC__/images/my.png">');
        }

        $('.tpdm-goods-nav').find('li').eq(0).click();  
	});

    function GetRTime(end_time){
        var NowTime = new Date();
        var t = (end_time*1000) - NowTime.getTime();
        var d=Math.floor(t/1000/60/60/24);
        var h=Math.floor(t/1000/60/60%24);
        var m=Math.floor(t/1000/60%60);
        var s=Math.floor(t/1000%60);
        if(s >= 0){
            var get_time=new Array();
            var h_fmort=d * 24 + h;
            get_time[0]=(h_fmort<10)?('0'+h_fmort):h_fmort;
            get_time[1]=(m<10)?('0'+m):m;
            get_time[2]=(s<10)?('0'+s):s;
            return get_time;
        }
    }
    function GetRTime2(){
        var get_time = GetRTime(end_time);
        if (get_time== 0){
            $(".hms").text('活动已结束');
        }else{
            $("#time_h").text(get_time[0]);
            $("#time_m").text(get_time[1]);
            $("#time_s").text(get_time[2]);
        }
    }
    function getCoupon(obj){
        $.ajax({
            type: "POST",
            url: "{:U('Mobile/Activity/getCoupon')}",
            data: {coupon_id: $(obj).data('coupon-id')},
            dataType: "json",
            error: function () {
                layer.alert("服务器繁忙, 请联系管理员!");
            },
            success: function (data) {
                if (data.status == 1) {
                    layer.open({content: data.msg,skin: 'msg',time: 2});
                    //$(obj).parent().parent().parent().remove();
                } else {
                    layer.open({content: data.msg,skin: 'msg',time: 2});
                }
            }
        });
    }
</script>
<script> 
$(".tpdm-goods-nav>li").click(function (){ 
    $(this).addClass("goodsnav-ac").siblings().removeClass("goodsnav-ac");
    var i=$(this).index();
    var t=$(this).parents('.tpd-edits-hidden').attr('data-timeid');
    
    var _this=this;

    $.post("{:U('Mobile/Index/goods_list_block')}",info[t].nav[i].sql_where,function(res){
        var info_json=JSON.parse(res);
        $(_this).parents('.tpdm-gdstyle').find('.tpdm-goods-wrap').html(info_json.result);
    });
}) 
//设置新品上市宽度
$(".containers-slider-cont").css("width",$(".containers-slider-cont .containers-slider-item").length*5.35+"rem");
</script>
<script type="text/javascript">
    //	商品详情页 滚动到一定位置固定定位
    $(window).scroll(function () {
        if ($(window).scrollTop() <= 10) {
            $(".tpd-search-tm").css({
                "opacity":"0.1",
                "background": "#000"
            });
            $(".tpd-search-warp>.tpd-logo").css({
                "background": "none"
            })
        } else {
            $(".tpd-search-tm").css({
                "background": "#de181b",
                "opacity": "0.9"
            });
            $(".tpd-search-warp>.tpd-logo").css({
                "background-color": "#fff"
            })
        }
    });
</script>
</html>
